<template>
	 <view class="container">
	    <view class="form">
	      <text class="title">注册</text>
	      <input class="input" placeholder="请输入用户名" v-model="username" />
	      <input class="input" placeholder="请输入密码" v-model="password" type="password" />
	      <input class="input" placeholder="请确认密码" v-model="confirmPwd" type="password" />
	      <button class="btn" type="primary" @click="handleRegister">注册</button>
	      <view class="link">
	        <text>已有账号？</text>
	        <navigator url="/pages/login/login" open-type="navigate">去登录</navigator>
	      </view>
	    </view>
	  </view>
	</template>
	
	<script>
	export default {
	  data() {
	    return {
	      username: '',
	      password: '',
	      confirmPwd: ''
	    };
	  },
	  methods: {
	    handleRegister() {
	      if (!this.username || !this.password || !this.confirmPwd) {
	        uni.showToast({
	          title: '请输入完整信息',
	          icon: 'none'
	        });
	        return;
	      }
	      if (this.password !== this.confirmPwd) {
	        uni.showToast({
	          title: '两次密码不一致',
	          icon: 'none'
	        });
	        return;
	      }
	      uni.showToast({
	        title: '注册成功',
	        icon: 'success'
	      });
	    }
	  }
	};
	</script>
	
	<style scoped>
	.container {
	  display: flex;
	  justify-content: center;
	  align-items: center;
	  min-height: 100vh;
	  background-color: #f5f5f5;
	}
	.form {
	  width: 80%;
	  background-color: #fff;
	  padding: 30rpx;
	  border-radius: 10rpx;
	  box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.1);
	}
	.title {
	  display: block;
	  font-size: 40rpx;
	  font-weight: bold;
	  margin-bottom: 30rpx;
	  text-align: center;
	}
	.input {
	  width: 100%;
	  height: 80rpx;
	  border: 1rpx solid #ddd;
	  border-radius: 6rpx;
	  margin-bottom: 20rpx;
	  padding: 0 20rpx;
	  box-sizing: border-box;
	}
	.btn {
	  margin-top: 30rpx;
	}
	.link {
	  display: flex;
	  justify-content: center;
	  margin-top: 20rpx;
	  font-size: 28rpx;
	  color: #666;
	}
	.link navigator {
	  color: #007aff;
	  margin-left: 10rpx;
	}
	</style>
